styleproperties: Adapt _gtk_style_properties_peek_property()
authorBenjamin Otte <otte@redhat.com>
Sat, 21 May 2011 15:19:50 +0000 (17:19 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 21 May 2011 20:49:43 +0000 (22:49 +0200)
Optionally return the GtkStyleProperty that was looked up. This feature
isn't used yet, but will soon be.

gtk/gtkstylecontext.c
gtk/gtkstyleproperties.c
gtk/gtkstylepropertiesprivate.h

index ca0c96e1fdbc51778d847e8da3aacf5e84a765ec..e96faea2d737540468dd438904d17d037900661a 100644 (file)
@@ -3363,7 +3363,9 @@ gtk_style_context_get_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "color", state);
+                                               "color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3402,7 +3404,9 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "background-color", state);
+                                               "background-color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3441,7 +3445,9 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "border-color", state);
+                                               "border-color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3481,7 +3487,9 @@ gtk_style_context_get_border (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "border-width", state);
+                                               "border-width",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3521,7 +3529,9 @@ gtk_style_context_get_padding (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "padding", state);
+                                               "padding",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3561,7 +3571,9 @@ gtk_style_context_get_margin (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "margin", state);
+                                               "margin",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3599,7 +3611,7 @@ gtk_style_context_get_font (GtkStyleContext *context,
   g_return_val_if_fail (priv->widget_path != NULL, NULL);
 
   data = style_data_lookup (context);
-  value = _gtk_style_properties_peek_property (data->store, "font", state);
+  value = _gtk_style_properties_peek_property (data->store, "font", state, NULL);
 
   if (value)
     return g_value_get_boxed (value);
index 2fd806b3d240286d5088367a294a994fa9ec1641..2b7f90d9fe78f55a46a0b7f8eaaea0c3cb7c42c2 100644 (file)
@@ -799,9 +799,10 @@ lookup_default_value (const GtkStyleProperty *node,
 }
 
 const GValue *
-_gtk_style_properties_peek_property (GtkStyleProperties *props,
-                                     const gchar        *prop_name,
-                                     GtkStateFlags       state)
+_gtk_style_properties_peek_property (GtkStyleProperties      *props,
+                                     const gchar             *prop_name,
+                                     GtkStateFlags            state,
+                                     const GtkStyleProperty **property)
 {
   GtkStylePropertiesPrivate *priv;
   const GtkStyleProperty *node;
@@ -812,6 +813,8 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
   g_return_val_if_fail (prop_name != NULL, NULL);
 
   node = _gtk_style_property_lookup (prop_name);
+  if (property)
+    *property = node;
 
   if (!node)
     {
index f4cea2d44ba26ac20a870b114edc154cf3ba792c..a75da4405b454a08ce588348bc10913f9074b196 100644 (file)
 #define __GTK_STYLE_PROPERTIES_PRIVATE_H__
 
 #include "gtkstyleproperties.h"
+#include "gtkstylepropertyprivate.h"
 
 G_BEGIN_DECLS
 
-const GValue * _gtk_style_properties_peek_property         (GtkStyleProperties *props,
-                                                            const gchar        *prop_name,
-                                                            GtkStateFlags       state);
+const GValue * _gtk_style_properties_peek_property         (GtkStyleProperties      *props,
+                                                            const gchar             *prop_name,
+                                                            GtkStateFlags            state,
+                                                            const GtkStyleProperty **property);
 
-void           _gtk_style_properties_set_property_by_pspec (GtkStyleProperties *props,
-                                                            GParamSpec         *pspec,
-                                                            GtkStateFlags       state,
-                                                            const GValue       *value);
+void           _gtk_style_properties_set_property_by_pspec (GtkStyleProperties      *props,
+                                                            GParamSpec              *pspec,
+                                                            GtkStateFlags            state,
+                                                            const GValue            *value);
 
 G_END_DECLS